FROM php:7.4.24-fpm
MAINTAINER hbw

ENV TZ "Asia/Shanghai"
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

#RUN apt-get clean 
#RUN curl -O  https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh 
#RUN bash ChangeMirrors.sh
#RUN apt-get update 
#RUN apt-get upgrade
# 设置镜像源 阿里云
#RUN cp /etc/apt/sources.list /etc/apt/sources.list.back
# 复制项目中镜像源配置文件
#ADD sources.list /etc/apt/sources.list

RUN  sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list \ 
	&& apt-get clean \
	&& apt-get update && apt-get install -y zlib1g-dev && apt-get install -y libzip-dev \
	&& apt-get install -y libfreetype6-dev \
	&& apt-get install -y libjpeg62-turbo-dev \ 
	&& apt-get install -y libpng-dev 

# 20211226 rabbitmq 安装扩展sockets
RUN docker-php-ext-install zip \
	&& docker-php-ext-install -j$(nproc) iconv \
	&& docker-php-ext-configure gd --with-freetype --with-jpeg \
	&&  docker-php-ext-install -j$(nproc) gd \
	&&  docker-php-ext-install pdo_mysql \
	&& docker-php-ext-install opcache \
	&& docker-php-ext-install mysqli \
	&& docker-php-ext-install  sockets \
	&& docker-php-ext-install bcmath \
	&& rm -r /var/lib/apt/lists/*

RUN pecl install xdebug && docker-php-ext-enable xdebug

RUN mkdir -p /usr/src/php/ext/redis \
    && curl -L https://github.com/phpredis/phpredis/archive/4.0.0.tar.gz | tar xvz -C /usr/src/php/ext/redis --strip 1 \
    && echo 'redis' >> /usr/src/php-available-exts \
    && docker-php-ext-install redis

RUN php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');" && \
    php composer-setup.php --install-dir=/usr/local/bin --filename=composer && \
    php -r "unlink('composer-setup.php');" && \
    composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ 


